let dept =  [{
  "name": "none",
  "value": "-"
}, {
  "name": "product_center",
  "value": "产品中心"
}, {
  "name": "quality_center",
  "value": "质量中心"
}]

let pos = [{
  "name": "root",
  "value": "超级管理员"
},{
  "name": "director",
  "value": "总监"
}, {
  "name": "worker",
  "value": "专员"
}, {
  "name": "user",
  "value": "成员"
}]

let authorization = [{
  'name': 'edit',
  'value': '编辑'
}, {
  'name': 'view',
  'value': '查看'
}, {
  'name': 'backup',
  'value': '备份'
}, {
  'name': 'backup_management',
  'value': '备份管理'
}]

let viewNEdit = [
  {
    'name': 'edit',
    'value': '编辑'
  }, {
    'name': 'view',
    'value': '查看'
  }
]

const getRoleByCN = (s) => {
  let arr = s.split(':')
  let _d = dept.find(ele => ele.value === arr[0]).name
  let _p = pos.find(ele => ele.value === arr[1]).name
  return  `${_d}:${_p}`
}

const getRoleByEN = (d, p) => {
  let _d = dept.find(ele => ele.name === d).value
  let _p = pos.find(ele => ele.name === p).value
  return  `${_d}:${_p}`
}

export { getRoleByCN, getRoleByEN, authorization, viewNEdit }